package com.gwnet.rider.controller;

import com.gwnet.common.core.domain.ResponseResult;
import com.gwnet.rider.domain.bo.CancelSetBoxBO;
import com.gwnet.rider.domain.bo.SetBoxBO;
import com.gwnet.rider.service.BoxService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 外卖箱/外卖柜骑手管理平台
 * @author: WangLiang
 * @date: 2024/8/5 8:35
 */
@RestController
@RequestMapping("/box")
public class BoxController {

    private final BoxService boxService;

    public BoxController(BoxService boxService) {
        this.boxService = boxService;
    }


    /**
     * 外卖员存放到外卖柜
     * @param setBoxBO
     * @return
     */
    @PostMapping("setBox")
    public ResponseResult<Boolean> setBox(@RequestBody SetBoxBO setBoxBO){
        // 存柜
        Boolean flag = boxService.setBox(setBoxBO);
        return ResponseResult.success(flag);
    }

    /**
     * 外卖员取消存放快递柜，重新取出来，选择其他方式，有可能直接送给用户，有可能重新换个柜子接着存
     * @param cancelSetBoxBO
     * @return
     */
    @PostMapping("/cancelSetBox")
    public ResponseResult<Boolean>  cancelSetBox(@RequestBody CancelSetBoxBO cancelSetBoxBO){
        // 取消投放快递柜
        Boolean flag = boxService.cancelSetBox(cancelSetBoxBO);
        return ResponseResult.success(flag);
    }



}
